<template>
	<view class="page">
		<cu-custom bgColor="bg-white" :isBack="true"><block slot="content">评价详情</block></cu-custom>
		<view class="cu-list menu bg-white padding-top" style="margin-top:0;border: 1rpx solid #F5F5F5;padding-bottom: 140rpx;" v-if="comment.member_name">
			<view class="cu-item">
				<view class="cu-avatar round lg margin-right-sm" v-if="comment.member_face" :style="'background-image:url('+comment.member_face+');'">
				</view>
				<view class="content">
					<view class="text-grey" style="height: 40rpx;">
						<view class="text-cut">{{comment.member_name}}</view>
						<image src="../../../static/images/icon_level3.png" style="width: 35rpx;height: 60rpx;" mode="aspectFit"></image>
					</view>
					<text class="text-gray text-sm flex">
						{{comment.create_time | unixToDate}} {{comment.comment_id}}
					</text>
				</view>
			</view>
			<view class="bg-white padding  padding-top-sm padding-bottom-sm" style="line-height: 40rpx;">
				<view class="text-df"> {{comment.content}}</view>
			</view>
			<view class="bg-white padding-left padding-right">
				<view class="grid col-2 grid-square">
					<view class="bg-img" v-for="(item1,index1) in comment.images" :key="index1" :style="[{ backgroundImage:'url(' + item1 + ')' }]" @tap="ViewImage" :data-url="index"></view>
				</view>
				<!-- <view class="bg-lightGrey padding padding-left padding-right">
					
				</view> -->
				<view class="bg-lightGrey radius20 overHidden margin-top-sm padding" v-if="commentGoods">
					<view class="flex">
						<view class="cu-avatar radius goodsImg" :style="'background-image:url('+commentGoods.thumbnail+')'"></view>
						<view class="content margin-left-sm" style="flex: 1;display: flex;flex-direction: column;">
							<view class="text-sm title_line_2" style="line-height:40upx;">
								{{commentGoods.goods_name}}
							</view>
							<view class="text-grey  flex margin-top " style="">
								<text class="text-theme text-df">￥{{commentGoods.price | formatPrice}}</text> <text class="text-999 text-xs wq-linethrough margin-left-sm">￥{{commentGoods.mktprice | formatPrice}}</text>
							</view>
						</view>
					</view>
				
				</view>
			</view>
			
			<view class="bg-white">
				<view class="flex align-center padding-left padding-top-sm padding-bottom-sm border-bottom-1">
					<image src="../../../static/images/completed.png" style="width: 40rpx;height:40rpx;"  mode=""></image>
					<text class="margin-left-sm text-black text-df" style="font-weight: 600;">全部评论</text>
				</view>
			</view>
			<view class="bg-white padding" style="min-height: 200rpx;">
				<view v-if="!comment.reply" class="flex align-center justify-center">暂无评论</view>
				<view v-else>
					{{comment.sku_id}} {{comment.goods_name}}
				</view>
			</view>
		</view>
		<!-- <view class="cu-bar bg-white tabbar foot border">
			<view class="flex justify-around align-center" style="width: 100%;">
				<view class="flex align-center">
					<image src="../../../static/images/icon_comment.png" class="bar-icon" mode=""></image>
					<text class="text-df">点赞</text>
				</view>
				<view class="flex align-center">
					<image src="../../../static/images/icon_comment.png" class="bar-icon" mode=""></image>
					<text class="text-df">评论</text>
				</view>
			</view>
		</view>	 -->
	</view>
</template>

<script>
	import * as Goods_API from '@/api/goods.js'
	export default {
		data() {
			return {
				params:{
					comment_id:'',
					goods_id :''
				},
				comment:{},
				izPraise:false,
				commentGoods:uni.getStorageSync('commentGoods')
			};
		},
		onLoad(e) {
			if(e.comment_id && e.goods_id){
				this.params.comment_id = e.comment_id
				this.params.goods_id = e.goods_id
				this.GET_CommentDetail()
			}else{
				uni.navigateBack({
					delta:1
				})
			}
		},
		methods:{
			GET_CommentDetail(){
				let {comment_id,goods_id} = this.params
				if(comment_id!='' && goods_id!=''){
					Goods_API.getGoodsCommentSingle(this.params).then(res=>{
						this.comment = res
						if(res.sku_id){
							// this.GET_CommentGoods()
						}
					})
				}
			},
			GET_CommentGoods(){
				let cSku_id = this.comment.sku_id
				Goods_API.goodsSku(this.params.goods_id).then(res=>{
					res.map(key =>{
						if(key.sku_id == cSku_id){
							console.log(key)
						}	
					})
				})
			},
			ViewImage(e) {
				uni.previewImage({
					urls: this.comment.images,
					current: e.currentTarget.dataset.url
				});
			},
		},
		destroyed() {
			uni.removeStorageSync('commentGoods')
		}
	}
</script>

<style lang="scss">
/deep/.cu-list.menu-avatar>.cu-item:after, .cu-list.menu>.cu-item:after {
	border-bottom: 0;
}
// /deep/.cu-bar.tabbar {
// 	height:80rpx;
// 	padding-bottom: 0;
// }
// /deep/.cu-bar {
// 	min-height: 80rpx;
// }
.bar-icon{
	width: 40rpx;
	height: 30rpx;
	margin-right: 10rpx;
}
</style>
